function clearDiv(){
    $("#chart1").empty();
}


function build(){

    var data = $("#data").val();
    if (  data != '' ){

        if( data != 'error' && data != '[]' ){
            var data2 = eval( $("#data").val());

            var $jq=jQuery.noConflict();
            var plot1 = $jq.jqplot('chart1', [data2], {
               axesDefaults: {
                    tickRenderer: $jq.jqplot.CanvasAxisTickRenderer ,
                    tickOptions: {
                        angle: -30,
                        fontSize: '10pt'

                    }
                },
                axes: {
                    xaxis: {
                        label:'Milestone',
                        renderer: $jq.jqplot.CategoryAxisRenderer,
                        labelRenderer: $jq.jqplot.CanvasAxisLabelRenderer,
                        fontSize: '14pt'
                    },
                    yaxis:{
                        label:'Average duration (days)',
                        labelRenderer: $jq.jqplot.CanvasAxisLabelRenderer,
                        fontSize: '14pt'
                    }
                },

                highlighter: {
                    show: true,
                    sizeAdjust: 10,
                    tooltipLocation: 'n',
                    tooltipAxes: 'y',
                    tooltipFormatString: "%.2f",
                    useAxesFormatters: false

                },
                cursor: {
                    show: false
                }
            });

        } else{
            if (data == 'error')
                openWindos('Choose a country');
            else
                openWindos('No data loaded');
        }



    }
}


